#ifndef _MIRRORED_VAR_H_
#define _MIRRORED_VAR_H_

#include <stdlib.h>
///////////////////////////////
// Simple utility function designed to help defeat basic memory hacking utilities
// like this one:
// http://www.softcows.com/memory_editor.htm
//
// It will not stop a determined hacker, but invalidation can be used as a first-warning flag

namespace util
{



struct	MirroredInt
{
public:
	MirroredInt()
	{
		Mask = rand();
		Set(0);
	}
	~MirroredInt()
	{

	}
	void			Set(int	Input)
	{
		t = Input;
		m = t ^ Mask;
	}
	int			Get()
	{
		return t;
	}
	int				GetMirrored()
	{
		return m ^ Mask;
	}
	bool			Check()
	{
		return Get() == GetMirrored();
	}	
	int				t;
	int				Mask;
	int				m;
};


} // namespace util

#endif // _MIRRORED_VAR_H_